<template>
  <div>
      <ul>
          <li v-for="(item,index) in arr" :key='item'>
            {{item}}
              <button @click="del(index)">删除</button>
            </li>
      </ul>
      <button @click="add">生成</button>
      
  </div>
</template>

<script>
export default {
  data(){
    return{
       arr : [1,2,3]
    }
  },
  methods: {
    add(){
      this.arr.push(this.arr.length+1)
    },
    del(index){
      this.arr.splice(index,1)
    }
  }
}
</script>

<style>

</style>